/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = ora_reftype_accessor.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2015/01/14 by songbb                               */
/*******************************************************************/

#include "frcomm.h"

#include "conntrack.h"
#include "frct_comm.h"

#include "../../ora_core.h"
#include "../../comm/ora_comm.h"
#include "../ora_mar_engine.h"
#include "ora_reftype_accessor.h"

/*******************************************************************************
*  FUNC     :  解析 reftype 类型数据
*  ARGS     :  *p_st_conn                           (ct信息)
*           :  *p_st_sess                           (Oracle私有的session)
*           :  *p_st_ora_packet                     (Oracle数据包)
*           :  *p_st_metadata                       (meta信息)
*  RTN      :  0                                    (FR_SUCC)
*              1                                    (FR_FAIL)
*  NOTE     :
*******************************************************************************/
int ora_reftype_accessor_unmarshal_one_row(Conntrack *p_st_conn
                                        , L7session_ora *p_st_sess
                                        , L7_ora_packet *p_st_ora_packet
                                        , Sql_metadata_info *p_st_metadata)
{
    int i_tmp = 0;
    char *p_tmp = NULL;

    if (p_st_metadata->i_isuseless == FR_YES || p_st_metadata->i_isnullbydescribe == FR_YES)
        goto success;

    if (ora_mar_unmarshalCLRforREFS(p_st_sess, p_st_ora_packet, &p_tmp, &i_tmp) == FR_SUCC)
        ora_free((void **) &p_tmp);
    else
        goto error;

success:
    return FR_SUCC;
error:
    return FR_FAIL;
}
